<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>管理员登录界面</title>
  <link rel="stylesheet" href="./css/bootstrap.min.css">
</head>
<style>
  h1{
    padding-left: 100px;
    font-family: "华文琥珀", serif;
  }
</style>
<body style="padding: 200px">
<div style="padding-left: 350px">
  <form action="AdminLogin" method="post" onsubmit="return Login()">
    <h1>UserLogin</h1>
    <p><input id="username" style="width: 400px" class="form-control" type="text" placeholder="请输入管理员账号" name="userName"/></p>
    <p><input id="password" style="width: 400px" class="form-control" type="password" placeholder="请输入管理员密码" name="userPass"/></p>
    <span style="color: red"><%= request.getAttribute("Error")==null?"":request.getAttribute("Error")%></span> <br/>
    <div >
      <button style="width: 400px" class="btn btn-success" type="submit">登  录</button>
    </div>
  </form>
</div>
<script>
  /**
   * @return {boolean}
   */
  function Login() {
    const username = $("#username").val(); // 获取id为username输入框中的值
    const password = $("#password").val(); // 获取id为password输入框中的值
    if (username === "" || password === "") {
      alert("账号或密码不能为空！");
      return false; // 账号或密码为空，次函数的返回值为false
    }
    return true; // 账号密码都不为空时才返回true
  }
</script>
</body>
<script src="./js/jquery-3.3.1.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
</html>